#!/usr/bin/env bash
set -e -u

# Redirect stderr to stdout
exec 2>&1

umask "<%- config['umask'] %>"

if [ "${1}" = "start" ]; then
  echo "starting ${2}..."

  run_args=("-e" "rc.env" "-c" "<%- config['_src_root_dir'] %>")
  exec runtool ${run_args[@]+"${run_args[@]}"} nginx -p "<%- config['_src_root_dir'] %>/" -c "<%- config['etc_dir'] %>/test-env/nginx/nginx.conf"
fi

exit 0
